package com.woniuxy.service.basics.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.dao.AccidentMapper;
import com.woniuxy.dao.CarsMapper;
import com.woniuxy.pojo.Cars;
import com.woniuxy.service.basics.CarService;

@Service
public class CarServiceImpl implements CarService{

	@Autowired
	private CarsMapper carsMapper;
	
	@Override
	public PageInfo selectAll(Integer pn,String condition) {
		PageHelper.startPage(pn, 5);
		List<Cars> list = carsMapper.selectAll(condition);
		PageInfo pageInfo = new PageInfo(list,3);
		return pageInfo;
		
	}
	@Override
	public int deleteCars(String carIds) {
		// TODO Auto-generated method stub
		return carsMapper.deleteCars(carIds);
	}
	@Override
	public void addCar(Cars car) {
		carsMapper.insert(car);
		
	}
	@Override
	public Cars selectById(Integer carId) {
		// TODO Auto-generated method stub
		return carsMapper.selectByPrimaryKey(carId);
	}
	@Override
	public void updateCar(Cars car) {
		carsMapper.updateByPrimaryKey(car);		
	}
	@Override

	public List<String> selectAllCarlicense(){
		// TODO Auto-generated method stub
		return carsMapper.selectAllCarlicense();
		
	}
	
	public List<Cars> selectStatus() {
		// TODO Auto-generated method stub
		return carsMapper.selectStatus();

	}

	@Override
	public Cars selectCarByCarlicense(String carLicense) {
		// TODO Auto-generated method stub
		return carsMapper.selectByCarLicense(carLicense);
	}


}
